package singleton;

public class PrintSpoolerHolder {

    private PrintSpoolerHolder() {
        System.out.println("创建打印池！");
    }

    // 静态内部类，只有在被调用时才会加载
    private static class SingletonHolder {
        private static final PrintSpoolerHolder INSTANCE = new PrintSpoolerHolder();
    }

    public static PrintSpoolerHolder getInstance() {
        return SingletonHolder.INSTANCE;  // 懒加载且线程安全
    }

    public void manageJobs() {
        System.out.println("管理打印任务！");
    }
}
